﻿#include <QCoreApplication>

#include "apple.h"
#include "book.h"
#include "customer.h"
#include "cashier.h"
#include "shoppingcart.h"

int main(int argc, char *argv[])
{
    QCoreApplication a(argc, argv);

    Apple* redApple = new Apple("red apple", 7);
    Apple* blueApple = new Apple("blue apple", 5);

    Book* book1 = new Book("book1", 30);
    Book* book2 = new Book("book2", 90);

    Cashier* cashier = new Cashier();
    Customer* customer = new Customer();

    customer->setNum(redApple, 5);
    customer->setNum(blueApple, 1);

    customer->setNum(book1, 10);
    customer->setNum(book2, 1);

    ShoppingCart* shoppingCart = new ShoppingCart();
    shoppingCart->add(redApple);
    shoppingCart->add(blueApple);

    shoppingCart->add(book1);
    shoppingCart->add(book2);

    shoppingCart->accept(customer);
    shoppingCart->accept(cashier);

    delete cashier;
    delete customer;

    delete book1;
    delete book2;

    delete redApple;
    delete blueApple;

    return a.exec();
}
